//
//  WZXActiveWebViewController.m
//  WWLNetease
//
//  Created by 李锦耀 on 16/1/4.
//  Copyright © 2016年 Echo.Jobs. All rights reserved.
//

#import "WZXActiveWebViewController.h"
#import <MBProgressHUD.h>
#define Kheight [[UIScreen mainScreen]bounds].size.height / 667

@interface WZXActiveWebViewController ()<UIWebViewDelegate>

@property(nonatomic, retain) UIWebView *webView;

@property(nonatomic, retain) MBProgressHUD *loadingHUD;

@end

@implementation WZXActiveWebViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.navigationController.navigationBar.barTintColor = [UIColor whiteColor];
    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCancel target:self action:@selector(backToHomePage:)];
    
    self.webView = [[UIWebView alloc]initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height)];
    
    self.loadingHUD = [MBProgressHUD showHUDAddedTo:self.webView animated:YES];
    self.loadingHUD.labelText = @"正在加载";
    self.loadingHUD.labelFont = [UIFont systemFontOfSize:17 * Kheight];
    [self.loadingHUD show:YES];
    // 自动适应屏幕
    self.webView.scalesPageToFit = YES;
    // 边界不回弹
    self.webView.scrollView.bounces = NO;
    // 隐藏滑动线
    self.webView.delegate = self;
    
    self.webView.scrollView.showsVerticalScrollIndicator = NO;
    NSString *url = @"http://3g.163.com/ntes/special/00340BF8/hdlb.html";
    NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:url]];
    [self.view addSubview:self.webView];
    [self.webView loadRequest:request];

}
- (void)webViewDidFinishLoad:(UIWebView *)webView
{
    [self.loadingHUD hide:YES];
}
- (void)backToHomePage:(UIBarButtonItem *)barButtonItem
{
    [self.Delegate changeNavigationBarColor];
    [self dismissViewControllerAnimated:YES completion:^{
        
        
    }];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
